package com.hs.sentinelr.service.impl;

import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hs.sentinelr.entity.User;
import com.hs.sentinelr.mapper.UserMapper;
import com.hs.sentinelr.service.UserService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * (User)表服务实现类
 *
 * @author makejava
 * @since 2021-05-03 15:36:44
 */
@Service("userService")
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Override
    @Cacheable(value = "users",key = "#root.method")
    public List<User> getAll() {
        return this.lambdaQuery().list().stream().limit(20).collect(Collectors.toList());
    }
}
